package com.czxy.dao;

import com.czxy.pojo.Spu;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

/**
 * SpuMapper类
 * @author Liuyunqin 17674029449@163.com
 * @date 2018/12/25 9:53
 */
@org.apache.ibatis.annotations.Mapper
public interface SpuMapper extends Mapper<Spu> {

    /**
     * 根据spuid查询spu
     * @param spuId
     * @return
     */
    @Select("SELECT * FROM tb_spu WHERE id=#{spuId}")
    @Results({
            @Result(property = "brand",column = "brand_id",
                    one = @One(select = "com.czxy.dao.BrandMapper.selectByPrimaryKey")),
            @Result(property = "cat3",column = "cat3_id",
                    one = @One(select = "com.czxy.dao.CategoryMapper.selectByPrimaryKey")),

    })
    public Spu findSpuBySpuId(@Param("spuId") Integer spuId);
}
